﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wfApplyDrawals.aspx.cs" Inherits="msBsc.WebUi.wMall.Seller.wfApplyDrawals" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="/themes/wStyle1/css/sLayout.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sHead.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sFoot.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/Seller/sDjackInfo.css" rel="stylesheet" />

    <link href="/themes/wStyle1/css/usermenu.css" rel="stylesheet" />
    <title>申请提现</title>
    <style>
        input[type=button] {
            width: 80px;
            height: 28px;
            text-align: center;
            line-height: 28px;
            border: 0;
            background-color: #7abd54;
            color: #fff;
            font-size: 14px;
            font-family: 微软雅黑;
            cursor: pointer;
        }

            input[type=button]:hover {
                opacity: 0.8;
            }

        .bind-notice-msg {
            width: 770px;
            padding: 10px 15px;
            border: 1px solid #f60;
            font-family: 微软雅黑;
            font-size: 16px;
            color: #0094ff;
            margin-bottom: 20px;
            text-indent: 32px;
        }

        .content-wrap {
            width: 100%;
            padding: 20px;
        }

            .content-wrap span {
                display: table-cell;
                padding-right: 15px;
            }

        .content-row {
            line-height: 45px;
        }

        .bindBank-title, .bindAlipay-title {
            width: 780px;
            height: 35px;
            line-height: 35px;
            font-family: 微软雅黑;
            font-size: 18px;
            color: #fff;
            background-color: #0094ff;
            padding-left: 20px;
        }

        .bindBank-content, .bindAlipay-content {
            width: 798px;
            border: 1px solid #808080;
        }

        .bindAlipayInfo {
            margin-top: 15px;
        }

        .notice-title {
            width: 120px;
            text-align: right;
            font-family: 微软雅黑;
            font-size: 14px;
            color: #808080;
            letter-spacing: 3px;
        }

        .lab-CCY {
            font-size: 20px;
            font-family: 微软雅黑;
            color: #f00 !important;
        }

        #labDrawals, #labPromBalance {
            font-size: 18px;
            font-family: 微软雅黑;
            color: #f60;
        }

        #txtApplyBalance {
            border: 0;
            border: 1px solid #808080;
            height: 25px;
            line-height: 25px;
            width: 200px;
        }

        .divAlipayInfo, .divBankInfo {
            border: 1px solid #0094ff;
            width: 450px;
            margin-left: 140px;
            margin-bottom: 20px;
        }

        .divBankInfo {
            display: none;
        }
    </style>
</head>
<body>
    <div class="wf_all">
        <div id="divLoginInfo">
            <%=msBsc.WebUi.Code.QtHtmlGet.GetHeaderLoginInfo() %>
        </div>
        <div class="main-container">
            <div class="sidebar-scroll">
                <%=msBsc.WebUi.Code.QtHtmlGet.GetDjackMenuHtml() %>
            </div>
            <div class="main-Info">
                <div class="main-menu">
                    <ul class="breadcrumb">
                        <li>
                            <a href="#">我的地接客</a>
                            <span class="divider">></span>
                        </li>
                        <li>
                            <a href="#" id="menuParent">账户中心</a>
                            <span class="divider">></span>
                        </li>
                        <li class="" id="menuName">申请提现
                        </li>
                    </ul>
                </div>

                <div class="content-wrap">
                    <div class="bindBankInfo" style="margin-bottom: 10px;">
                        <div class="bindBank-title">账户信息</div>
                        <div class="bindBank-content">
                            <div class="content-row">
                                <span class="notice-title">账户类型:</span>
                                <span class="cust-input">
                                    <input type="radio" name="radAccType" id="radAlipay" checked="checked" /><label for="radAlipay">支付宝账户</label>
                                    <%--<input type="radio" name="radAccType" id="radBank" /><label for="radBank">银行账户</label>--%>
                                </span>
                            </div>

                            <div class="divAlipayInfo">
                                <div class="content-row">
                                    <span class="notice-title">支付宝账号:</span>
                                    <span class="cust-input">
                                        <label id="labAliAccount"></label>
                                    </span>
                                </div>
                            </div>

                            <%--<div class="divBankInfo">
                                <div class="content-row">
                                    <span class="notice-title">银行账号:</span>
                                    <span class="cust-input">
                                        <label id="labBankAccount"></label>
                                    </span>
                                </div>
                                <div class="content-row">
                                    <span class="notice-title">用户名:</span>
                                    <span class="cust-input">
                                        <label id="labBankAccNme"></label>
                                    </span>
                                </div>
                                <div class="content-row">
                                    <span class="notice-title">开户行:</span>
                                    <span class="cust-input">
                                        <label id="labBankSource"></label>
                                    </span>
                                </div>
                                <div class="content-row">
                                    <span class="notice-title">银行名称:</span>
                                    <span class="cust-input">
                                        <label id="labBankAddrNme"></label>
                                    </span>
                                </div>
                            </div>--%>
                        </div>
                    </div>

                    <div class="bindBankInfo">
                        <div class="bindBank-title">申请提现</div>
                        <div class="bindBank-content">
                            <div class="content-row">
                                <span class="notice-title">账户余额:</span>
                                <span class="cust-input">
                                    <label class="lab-CCY">￥</label><label id="labDrawals"></label>
                                </span>
                            </div>
                            <div class="content-row">
                                <span class="notice-title">提现金额:</span>
                                <span class="cust-input">
                                    <input type="text" id="txtApplyBalance" value="" placeholder="请输入提现金额" />
                                </span>
                            </div>
                            <div class="content-row">
                                <span class="notice-title"></span>
                                <span class="cust-input">
                                    <input type="button" id="btnDrawals" value="提交申请" style="margin-left: 500px;" />
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--start JS引用-->
        <script src="/jqPlugin/js/jquery-1.8.3.min.js"></script>
        <script src="/jqPlugin/js/jBase.js"></script>
        <script src="/jqPlugin/js/jBPage.js"></script>
        <script src="/jqPlugin/js/laytpl.js"></script>
        <script src="/themes/wStyle1/js/comm/VerifyJs.js"></script>

        <script src="/jqPlugin/SelectSimu/js/SelectSimu.js"></script>
        <script src="/themes/wStyle1/js/comm/jsLayout.js"></script>
        <!--end JS引用-->

        <script type="text/javascript">
            var totalBalance = 0;
            $(function () {
                var currentVal = "";
                var nextVal = "";
                var KeyVal = "";
                $("#txtApplyBalance").focus().keydown(function () {
                    currentVal = $(this).val();
                }).keyup(function () {
                    nextVal = ComfirmBalance(currentVal);
                    $(this).val(nextVal);
                })

                checkShowAccount();

                $("input[type=radio]").click(function () {
                    checkShowAccount();
                });

                $("#btnDrawals").click(function () {
                    SubmitApply();
                })
            })

            function ComfirmBalance(beforeVal) {
                var newVal = $("#txtApplyBalance").val();

                if (isNaN(newVal)) {
                    alert("数字格式错误，请输入正确的数字");
                    return beforeVal;
                }

                if (newVal - totalBalance > 0) {
                    alert("输入的金额不能大于账户余额，请重新输入");
                    return beforeVal;
                }
                return newVal;
            }

            function checkShowAccount() {
                var checkedId = $("input[type=radio]:checked").attr("id");

                if (checkedId == "radAlipay") {
                    $(".divAlipayInfo").show();
                    $(".divBankInfo").hide();
                }
                else if (checkedId == "radBank") {
                    $(".divAlipayInfo").hide();
                    $(".divBankInfo").show();
                }
            }

            function SetAccountInfo(_data) {
                if (IsNull(_data.rows[0].CUSTOMER_ALIPAY_ACCOUNT)) {
                    $("#radBank").attr("checked", "checked");
                }

                $("#labDrawals").text(IsNull(_data.rows[0].CUSTOMER_DRAWALS_ACCOUNT) ? "0.00" : _data.rows[0].CUSTOMER_DRAWALS_ACCOUNT);
                totalBalance = $("#labDrawals").text();
                $("#labAliAccount").text(IsNull(_data.rows[0].CUSTOMER_ALIPAY_ACCOUNT) ? "暂未绑定" : _data.rows[0].CUSTOMER_ALIPAY_ACCOUNT);
                $("#labBankAccount").text(IsNull(_data.rows[0].CUSTOMER_BANK_ACCOUNT) ? "暂未绑定" : _data.rows[0].CUSTOMER_BANK_ACCOUNT);
                $("#labBankSource").text(IsNull(_data.rows[0].BANK_NME) ? "暂未绑定" : _data.rows[0].BANK_NME);
                $("#labBankAccNme").text(IsNull(_data.rows[0].CUSTOMER_ACCOUNT_NAME) ? "暂未绑定" : _data.rows[0].CUSTOMER_ACCOUNT_NAME);
                $("#labBankAddrNme").text(IsNull(_data.rows[0].CUSTOMER_BANK_NAME) ? "暂未绑定" : _data.rows[0].CUSTOMER_BANK_NAME);
            }

            function SubmitApply() {
                if ($("#labDrawals").text() - 0 <= 0) {
                    alert("账户无可提现金额");
                    return;
                }

                var drawalsBalance = $.trim($("#txtApplyBalance").val());

                if (isNaN(drawalsBalance)) {
                    alert("请输入正确的提现金额");
                    return;
                }

                if (drawalsBalance - 0 <= 0) {
                    alert("提现金额必须大于零");
                    return;
                }

                if ($("#labDrawals").text() - drawalsBalance < 0) {
                    alert("提现金额不得大于账户余额");
                    return;
                }

                var oparm = new jsonRow();
                oparm.AddCell("ACTION", "SubmitApply");
                oparm.AddCell("Balance", drawalsBalance);
                oparm.AddCell("DrawalsType", $("input[type=radio]:checked").attr("id") == "radAlipay" ? "1" : "2");
                $("#txtApplyBalance").attr("disabled", "disabled");
                $("#btnDrawals").attr("disabled", "disabled");
                ajaxComm(oparm, null, function () {
                    $("#txtApplyBalance").removeAttr("disabled");
                    $("#btnDrawals").removeAttr("disabled");
                });
            }

            function ShowSuccessMsg(msg) {
                alert(msg);
                window.location.href = "/ws_ApplyDrawals.htm";
            }
        </script>

        <%=msBsc.WebUi.Code.QtHtmlGet.GetFloorHtml() %>
    </div>
</body>
</html>
